package lesson13;

import javax.swing.*;
import javax.swing.border.Border;
import java.awt.*;

/**
 * 布局管理器
 */
public class Test04 extends JFrame {
    private JButton btn1 = new JButton("按钮1");
    private JButton btn2 = new JButton("按钮2");
    private JButton btn3 = new JButton("按钮3");
    private JButton btn4 = new JButton("按钮4");
    private JButton btn5 = new JButton("按钮5");
    public Test04(){
        // 东西南北中布局
//        this.setLayout(new BorderLayout());
        // 流布局管理器
//        this.setLayout(new FlowLayout());
        // 网格布局管理器
        this.setLayout(new GridLayout(2,3));

//        this.add(btn1,BorderLayout.NORTH);
//        this.add(btn2,BorderLayout.SOUTH);
//        this.add(btn3,BorderLayout.WEST);
//        this.add(btn4,BorderLayout.EAST);
//        this.add(btn5,BorderLayout.CENTER);

//        btn1.setFont(new Font("宋体",Font.BOLD,50));
        this.add(btn1);
        this.add(btn2);
        this.add(btn3);
        this.add(btn4);
        this.add(btn5);

        this.setSize(800,600);
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        this.setLocationRelativeTo(null);
        this.setVisible(true);
    }

    public static void main(String[] args) {
        new Test04();
    }
}
